package com.example.big_job.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.big_job.R;

import java.util.List;

public class IntroduceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{

    private Context context;
    private List<Integer> mDatas;


    public IntroduceAdapter(Context context, List<Integer> mDatas) {
        this.context = context;
        this.mDatas = mDatas;
    }
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view;
        view= LayoutInflater.from(context).inflate(R.layout.item_introduce, parent, false);
        return new IntroduceAdapter.adviceViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        IntroduceAdapter.adviceViewHolder adviceviewHolder=(IntroduceAdapter.adviceViewHolder) holder;
        if (position==1){
            adviceviewHolder.tn.setText("吉祥餐馆（西湖店）");
            adviceviewHolder.ta.setText("\uD83D\uDCCD杭州市上城区解放路319号");
            adviceviewHolder.i1.setImageResource(R.drawable.o3);
            adviceviewHolder.i2.setImageResource(R.drawable.o4);
            adviceviewHolder.i3.setImageResource(R.drawable.o10);
        }else if (position==2){
            adviceviewHolder.tn.setText("吉祥餐馆（下沙店）");
            adviceviewHolder.ta.setText("\uD83D\uDCCD杭州市钱塘区文泽路456号");
            adviceviewHolder.i1.setImageResource(R.drawable.o5);
            adviceviewHolder.i2.setImageResource(R.drawable.o6);
            adviceviewHolder.i3.setImageResource(R.drawable.o11);
        }else if (position==3){
            adviceviewHolder.tn.setText("吉祥餐馆（机场店）");
            adviceviewHolder.ta.setText("\uD83D\uDCCD杭州市萧山区南临路1号");
            adviceviewHolder.i1.setImageResource(R.drawable.o7);
            adviceviewHolder.i2.setImageResource(R.drawable.o8);
            adviceviewHolder.i3.setImageResource(R.drawable.o12);
        }
    }

    @Override
    public int getItemCount() {
        return 4;
    }
    public class adviceViewHolder extends RecyclerView.ViewHolder{
        private TextView tn;
        private TextView ta;
        private ImageView i1;
        private ImageView i2;
        private ImageView i3;

        public adviceViewHolder(@NonNull View itemView) {
            super(itemView);
            tn=itemView.findViewById(R.id.on);
            ta=itemView.findViewById(R.id.oa);
            i1=itemView.findViewById(R.id.o1);
            i2=itemView.findViewById(R.id.o2);
            i3=itemView.findViewById(R.id.o3);
        }
    }
}

